<!DOCTYPE html>
<html>

<head>
    <title>考拉管家</title>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="tephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" href="../Public/Lib/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="../Public/Lib/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="../Public/css/global.css">
    <link rel="stylesheet" href="../Public/css/css.css">
    <script type="text/javascript" src="../Public/Lib/plugins/jQuery/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="../Public/Lib/plugins/Vue/Vue.js"></script>
    <script type="text/javascript" src="../Public/js/api.js"></script>
    <script type="text/javascript" src="../Public/js/common.js"></script>
    <style type="text/css">
    html {
        background-color: white;
        background-image: url("../image/bg.jpg"); background-size: 100% auto;
    }
    
    span {
        padding: 10px 15px;
        margin: 10px;
        display: inline-block;
        background-color: #e8e8e8;
    }
    
    .hover {
        opacity: .4;
    }

    /*#LoginPage{ display: none; }*/
    </style>
</head>

<body>
    <div class="container-fluid" id="LoginPage">
        <div class="loginTitle">登录</div>
        <div class="row LoginArea">
            <div class="col-xs-12 LoginBG">
                
            </div>
            <div class="col-xs-12 LoginRow">
                <div class="col-xs-12 textleft">
                    <div class="login_name_label">电话号码</div>
                </div>
                <div class="col-xs-12">
                    <input type="text" name="" id="login_name" class="form-control noneBg textInput" value="" required="required" title="" placeholder="">
                </div>
            </div>

            <div class="col-xs-12 LoginRow LoginRowLast">
                <div class="col-xs-12">
                    <input type="password" name="" id="password" class="form-control noneBg textInput" value="" required="required" title="" placeholder="">
                </div>
            </div>
            <div class="col-xs-12 textright LoginSubmitRow">
                <img v-on:click="loadData()" src="../image/button.png">
            </div>
        </div>
    </div>
    <script type="text/javascript">
        var HjVue = new Vue({
            el: '#LoginPage',
            data: {
                list: []
            },
            methods: {
                loadData: function(){
                    
                    JsonPost("/ajax/RedirectApi/urlCode/Login-dologin",{
                        "login_name" : $('#login_name').val(),
                        "password" : $('#password').val(),
                        "org_code" : '',
                    },function(msg){

                        if(msg.flag == 1){
                            $api.setStorage('Token', msg.data.userInfo.token);
                            PushController(HtmlHost+"/MobileApp/Android?token="+msg.data.userInfo.token);
                            $('#password').val('');
                            //h
                        }else{
                            api.toast({
                                msg: msg.msg
                            });
                        }

                    },function(){
                        api.toast({
                            msg: '登录失败'
                        });
                    });

                }
            }
        });
        
        apiready = function(){
            token = $api.getStorage('Token');
            if(typeof(token)!='undefined'){  ///gobal/getCurrentUserInfo /gobal/getCurrentUserInfo
                JsonPost("/ajax/RedirectApi/urlCode/Login-getCurrentUserInfo",{
                    "token" : token
                },function(msg){
                    if(msg.flag == 1){
                        PushController(HtmlHost+"/MobileApp/Android?token="+token);
                    }
                    
                },function(){

                },"验证账号信息");

                setTimeout(function(){
                    $('#LoginPage').show();
                },1000);
            }else{
                $('#LoginPage').show();
            }
        }
            
    </script>
</body>
</html>